package org.pzy.java.reflect;

/**
 * @Author: DRevelation
 * @Date: 2022/2/23 10:03
 */
public class TargetObject {

    static {
        System.out.println("static");
    }

    public TargetObject() {
        System.out.println("====== constructor ======");
    }

    public static void main(String[] args) throws ClassNotFoundException {
        // 1
        Class<TargetObject> clazz1 = TargetObject.class;
        System.out.println("====== clazz1 end ======");
        // 2
        Class<?> clazz2 = Class.forName("org.pzy.java.reflect.TargetObject");
        System.out.println("====== clazz2 end ======");
        // 3
        TargetObject obj = new TargetObject();
        obj.getClass();
        System.out.println("====== clazz3 end ======");
        // 4 无法从静态上下文中引用非静态 方法 loadClass(java.lang.String)
//        Class<?> clazz3 = ClassLoader.loadClass("org.pzy.java.reflect.TargetObject");
    }

}
